﻿<%@ Page Title="" Language="C#" MasterPageFile="~/presentation/MasterPage.Master"
    AutoEventWireup="true" CodeBehind="TaxaForm.aspx.cs" Inherits="ISHotel_ASP.presentation.TaxaForm" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div align="left" class="art-blockcontent-body">
        <table>
            <tr>
                <td>
                </td>
                <td align="center">
                    <asp:Label ID="LabelNovaTaxa" runat="server" Text="Nová taxa"></asp:Label>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="LabelNazev" runat="server" Text="Název taxy:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="TextBoxNazev" runat="server" MaxLength="50"></asp:TextBox>
                </td>
                <td>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidatorNazev" runat="server" ErrorMessage="*"
                        ControlToValidate="TextBoxNazev"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="LabelPopis" runat="server" Text="Popis taxy:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="TextBoxPopis" runat="server" Height="60px" TextMode="MultiLine"
                        Width="230px" MaxLength="1000"></asp:TextBox>
                </td>
                <td>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="LabelCena" runat="server" Text="Cena za noc:"></asp:Label>
                </td>
                <td>
                    <asp:TextBox ID="TextBoxCena" runat="server" MaxLength="5"></asp:TextBox>
                </td>
                <td>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidatorCena" runat="server" ErrorMessage="*"
                        ControlToValidate="TextBoxCena"></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="Jen čísla!"
                        ValidationExpression="\d+" ControlToValidate="TextBoxCena">
                    </asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td>
                </td>
                <td align="center">
                    <asp:Button ID="ButtonVlozTaxu" runat="server" Text="Vlož" OnClick="ButtonVlozTaxy_Click" />
                </td>
                <td>
                </td>
            </tr>
        </table>
        <asp:ObjectDataSource ID="ODS_ListTaxa" runat="server" SelectMethod="Select" TypeName="ISHotelApp.Database.TaxaTable">
        </asp:ObjectDataSource>
        <br />
        <asp:Label ID="LabelErr" runat="server" Visible="True" ForeColor="Red"></asp:Label>
        <br />
        <br />
        <asp:GridView ID="GridViewTaxa" runat="server" AutoGenerateColumns="False" DataSourceID="ODS_Taxa"
            AllowPaging="True" DataKeyNames="id_taxy">
            <Columns>
                <asp:TemplateField ShowHeader="False">
                    <ItemTemplate>
                        <asp:ImageButton ID="ImageButtonDel" runat="server" CommandArgument='<%# Eval("id_taxy") %>'
                            CommandName="DeleteTaxa" OnCommand="button_Command" ImageUrl="~/images/delete.jpg"
                            OnClientClick="javascript: return confirm(&apos;Opravdu smazat taxu?&apos;);" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="nazev_taxy" HeaderText="Název taxy" SortExpression="nazev_taxy" />
                <asp:BoundField DataField="popis_taxy" HeaderText="Popis taxy" SortExpression="popis_taxy"
                    ItemStyle-Width="200" />
                <asp:BoundField DataField="cena_taxy" HeaderText="Cena za noc" SortExpression="cena_taxy" />
                <asp:CommandField ShowSelectButton="True" HeaderText="Upravit" SelectImageUrl="../images/pencil.gif"
                    ButtonType="Image" ItemStyle-HorizontalAlign="Center" />
            </Columns>
        </asp:GridView>
        <asp:ObjectDataSource ID="ODS_Taxa" runat="server" SelectMethod="Select" TypeName="ISHotelApp.Database.TaxaTable"
            DeleteMethod="Delete">
            <DeleteParameters>
                <asp:Parameter Name="id_taxy" Type="Int32" />
            </DeleteParameters>
        </asp:ObjectDataSource>
        <br />
        <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="300px" AutoGenerateRows="False"
            DataSourceID="ODS_TaxaDetail" DataKeyNames="id_taxy">
            <Fields>
                <asp:TemplateField HeaderText="Název taxy" SortExpression="nazev_taxy">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("nazev_taxy") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("nazev_taxy") %>' MaxLength="50"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidatorJmenoDetail" runat="server"
                            ErrorMessage="*" ControlToValidate="TextBox2" ValidationGroup="Detail"></asp:RequiredFieldValidator>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Popis taxy" SortExpression="popis_taxy">
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("popis_taxy") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("popis_taxy") %>' MaxLength="1000"
                            TextMode="MultiLine" Height="50"></asp:TextBox>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Cena za noc" SortExpression="cena_taxy">
                    <ItemTemplate>
                        <asp:Label ID="Label3" runat="server" Text='<%# Bind("cena_taxy") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("cena_taxy") %>' MaxLength="5"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidatorUliceDetail" runat="server"
                            ErrorMessage="*" ControlToValidate="TextBox4" ValidationGroup="Detail"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidatorPSC3Detail" runat="server"
                            ErrorMessage="Jen čísla!" ValidationExpression="\d+" ControlToValidate="TextBox4"
                            ValidationGroup="Detail">
                        </asp:RegularExpressionValidator>
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:CommandField ShowEditButton="True" CausesValidation="True" ValidationGroup="Detail" />
            </Fields>
        </asp:DetailsView>
        <asp:ObjectDataSource ID="ODS_TaxaDetail" runat="server" SelectMethod="Select" UpdateMethod="Update"
            OnUpdated="TaxaDetail_OnUpdated" DataObjectTypeName="ISHotelApp.Database.Taxa" TypeName="ISHotelApp.Database.TaxaTable">
            <SelectParameters>
                <asp:ControlParameter PropertyName="SelectedValue" Type="int32" Name="id_taxy" ControlID="GridViewTaxa">
                </asp:ControlParameter>
            </SelectParameters>
        </asp:ObjectDataSource>
    </div>
</asp:Content>
